package com.zhp.controller.dept;

import com.zhp.controller.BaseController;
import com.zhp.service.DeptService;
import com.zhp.service.impl.DeptServiceImpl;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;

@WebServlet("/dept/*")
public class DeptController extends BaseController {

    private DeptService deptService = new DeptServiceImpl();

    public void list(HttpServletRequest req, HttpServletResponse resp){
        try {
            List<Map<String, Object>> deptList = deptService.getDeptList();
            req.setAttribute("deptList",deptList);
            req.getRequestDispatcher("/assets/html/department.jsp").forward(req,resp);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}
